package ckf.man.practice.controller;

import ckf.man.practice.entity.LateralLine;
import ckf.man.practice.service.LateralLineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/lateral_line")
public class LateralLineController {
    @Autowired
    private LateralLineService service;

    @GetMapping("/get")
    public List<LateralLine> get(){
        return service.list();
    }

    @PostMapping("/getById")
    public LateralLine getById(@RequestBody Map<String,Integer> data){
        return service.getById(data.get("id"));
    }

    @PostMapping("/getByEquipment")
    public List<LateralLine> getByEquipment(@RequestBody Map<String,Integer> data){
        return service.getByEquipment(data.get("equipment_id"));
    }

    @PostMapping("/getByScheme")
    public List<LateralLine> getByScheme(@RequestBody Map<String,Integer> data){
        return service.getByScheme(data.get("scheme_id"));
    }

    @PostMapping("/getByEquipmentAndScheme")
    public List<LateralLine> getByEquipmentAndScheme(@RequestBody Map<String,Integer> data){
        return service.getByEquipmentAndScheme(data.get("equipment_id"),data.get("scheme_id"));
    }
}
